﻿@page
@model XZTZ.UMP.WEB.Pages.Base.BillProperty.IndexModel

@{
	ViewData["Title"] = "Index";
}

<h1>Index</h1>

<p>
	<a asp-page="Create">Create New</a>
</p>
<form asp-page="./Index" method="get">
	<div class="form-actions no-color">
		<p>
			@Html.DisplayNameFor(model => model.BillProperty[0].StrPropertyName):
			<input type="text" name="SearchString" value="@Model.CurrentFilter" />
			<input type="submit" value="Search" class="btn btn-default" /> |
			<a asp-page="./Index">Back to full List</a>
		</p>
	</div>
</form>
<table class="table">
	<thead>
		<tr>
			<th>
				<a asp-page="./Index" asp-route-sortOrder="@Model.StrPropertyName" asp-route-currentFilter="@Model.CurrentFilter">
					@Html.DisplayNameFor(model => model.BillProperty[0].StrPropertyName)
				</a>


			</th>
			<th>
				<a asp-page="./Index" asp-route-sortOrder="@Model.DateSort" asp-route-currentFilter="@Model.CurrentFilter">
					@Html.DisplayNameFor(model => model.BillProperty[0].DtmOperateDate)
				</a>
			</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
		@foreach (var item in Model.BillProperty)
		{
			<tr>
				<td>
					@Html.DisplayFor(modelItem => item.StrPropertyName)
				</td>
				<td>
					@Html.DisplayFor(modelItem => item.DtmOperateDate)
				</td>
				<td>
					<a asp-page="./Edit" asp-route-id="@item.StrPropertyId">Edit</a> |
					<a asp-page="./Details" asp-route-id="@item.StrPropertyId">Details</a> |
					<a asp-page="./Delete" asp-route-id="@item.StrPropertyId">Delete</a>
				</td>
			</tr>
		}
	</tbody>
</table>
@{
	var prevDisabled = !Model.BillProperty.HasPreviousPage ? "disabled" : "";
	var nextDisabled = !Model.BillProperty.HasNextPage ? "disabled" : "";
}

<a asp-page="./Index"
   asp-route-sortOrder="@Model.CurrentSort"
   asp-route-pageIndex="@(Model.BillProperty.PageIndex - 1)"
   asp-route-currentFilter="@Model.CurrentFilter"
   class="btn btn-default @prevDisabled">
	Previous
</a>
@*@for (int k = 1; k < @Model.BillProperty.TotalPages; k++)
	{
		if (k >= @Model.BillProperty.PageIndex - 2 && k <= @Model.BillProperty.PageIndex + 2)
		{
			<a>@k</a>
		}
		else
		{
			<a>…</a>
		}
	}*@
<a asp-page="./Index"
   asp-route-sortOrder="@Model.CurrentSort"
   asp-route-pageIndex="@(Model.BillProperty.PageIndex + 1)"
   asp-route-currentFilter="@Model.CurrentFilter"
   class="btn btn-default @nextDisabled">
	Next
</a>
<span>@Model.BillProperty.TotalPages</span>